package nl.vddijssel.social.client;

import nl.vddijssel.social.client.place.AppPlaceHistoryMapper;
import nl.vddijssel.social.client.place.InitPlace;
import nl.vddijssel.social.login.client.Login;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class SocialTekstAnalyser implements EntryPoint {
	
	final Place defaultPlace = new InitPlace();

	public void onModuleLoad() {
		
		ClientFactory clientFactory = GWT.create(ClientFactory.class);
		PlaceController placeController = clientFactory.getPlaceController();
		EventBus eventBus = clientFactory.getEventBus();
		
		//load Modules
		Login login = new Login(RootPanel.get("login"),clientFactory);
		
        // Start PlaceHistoryHandler with our PlaceHistoryMapper
        AppPlaceHistoryMapper historyMapper= GWT.create(AppPlaceHistoryMapper.class);
        PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
        historyHandler.register(placeController, eventBus, defaultPlace);
        
        historyHandler.handleCurrentHistory();

	}
}
